package com.clinic.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;

@Entity
@PrimaryKeyJoinColumn(name = "pe_obj_id")
public class Profile extends Super_type {

	private static final long serialVersionUID = 1L;

	@Column(insertable = false, updatable = false)
	private int pe_obj_id;
	@Column(length = 1024)
	private String allergy_frm;
	@Column(nullable = true)
	private boolean update_profile;
	@Column(nullable = true)
	private boolean clinic_reservation;
	@Column(nullable = true)
	private boolean patient_reservation;
	@Column(nullable = true)
	private boolean clinic_info_update;
	@Column(nullable = true)
	private boolean view_doctors_names;
	@Column(nullable = true)
	private boolean view_health_reports;
	@Column(length = 1024)
	private String favorite_clinics;
	@Column(length = 1024)
	private String favorite_doctors;
	@OneToOne(cascade = CascadeType.ALL)
	@JoinColumn(name = "pt_obj_id", nullable = false)
	private Patient patient;
	@OneToMany(mappedBy = "profile", cascade = CascadeType.ALL)
	private List<Health_report> health_reports;

	public List<Health_report> getHealth_reports() {
		return health_reports;
	}

	public void setHealth_reports(List<Health_report> health_reports) {
		this.health_reports = health_reports;
	}

	public Profile() {
		super();
	}

	public Profile(String obj_owner_name, String allergy_frm,
			boolean update_profile, boolean clinic_reservation,
			boolean patient_reservation, boolean clinic_info_update,
			boolean view_doctors_names, boolean view_health_reports,
			String favorite_clinics, String favorite_doctors) {
		super(obj_owner_name);
		this.allergy_frm = allergy_frm;
		this.update_profile = update_profile;
		this.clinic_reservation = clinic_reservation;
		this.patient_reservation = patient_reservation;
		this.clinic_info_update = clinic_info_update;
		this.view_doctors_names = view_doctors_names;
		this.view_health_reports = view_health_reports;
		this.favorite_clinics = favorite_clinics;
		this.favorite_doctors = favorite_doctors;
	}

	public Profile(String obj_owner_name, String allergy_frm,
			boolean update_profile, boolean clinic_reservation,
			boolean patient_reservation, boolean clinic_info_update,
			boolean view_doctors_names, boolean view_health_reports,
			String favorite_clinics, String favorite_doctors, Patient patient) {
		super(obj_owner_name);
		this.allergy_frm = allergy_frm;
		this.update_profile = update_profile;
		this.clinic_reservation = clinic_reservation;
		this.patient_reservation = patient_reservation;
		this.clinic_info_update = clinic_info_update;
		this.view_doctors_names = view_doctors_names;
		this.view_health_reports = view_health_reports;
		this.favorite_clinics = favorite_clinics;
		this.favorite_doctors = favorite_doctors;
		this.patient = patient;
	}

	public Patient getPatient() {
		return patient;
	}

	public void setPatient(Patient patient) {
		this.patient = patient;
	}

	public int getPe_obj_id() {
		return pe_obj_id;
	}

	public String getAllergy_frm() {
		return allergy_frm;
	}

	public void setAllergy_frm(String allergy_frm) {
		this.allergy_frm = allergy_frm;
	}

	public boolean isUpdate_profile() {
		return update_profile;
	}

	public void setUpdate_profile(boolean update_profile) {
		this.update_profile = update_profile;
	}

	public boolean isClinic_reservation() {
		return clinic_reservation;
	}

	public void setClinic_reservation(boolean clinic_reservation) {
		this.clinic_reservation = clinic_reservation;
	}

	public boolean isPatient_reservation() {
		return patient_reservation;
	}

	public void setPatient_reservation(boolean patient_reservation) {
		this.patient_reservation = patient_reservation;
	}

	public boolean isClinic_info_update() {
		return clinic_info_update;
	}

	public void setClinic_info_update(boolean clinic_info_update) {
		this.clinic_info_update = clinic_info_update;
	}

	public boolean isView_doctors_names() {
		return view_doctors_names;
	}

	public void setView_doctors_names(boolean view_doctors_names) {
		this.view_doctors_names = view_doctors_names;
	}

	public boolean isView_health_reports() {
		return view_health_reports;
	}

	public void setView_health_reports(boolean view_health_reports) {
		this.view_health_reports = view_health_reports;
	}

	public String getFavorite_clinics() {
		return favorite_clinics;
	}

	public void setFavorite_clinics(String favorite_clinics) {
		this.favorite_clinics = favorite_clinics;
	}

	public String getFavorite_doctors() {
		return favorite_doctors;
	}

	public void setFavorite_doctors(String favorite_doctors) {
		this.favorite_doctors = favorite_doctors;
	}

	@Override
	public void _toString() {
		System.out.println("Enter - _toString");
		super._toString();
		System.out.println("allergy from: " + this.allergy_frm
				+ "\nfavorite clinics: " + this.favorite_clinics
				+ "\nfavorite doctors: " + this.favorite_doctors
				+ "\nclinic info update: " + this.clinic_info_update
				+ "\nclinic reservation: " + this.clinic_reservation
				+ "\npatient reservation: " + this.patient_reservation
				+ "\nupdate profile: " + this.update_profile
				+ "\nview doctors names: " + this.view_doctors_names
				+ "\nview health reports: " + this.view_health_reports
				+ "\npatient ID: " + this.patient.getPt_obj_id()
				+ "\nHealth_reports: " + this.health_reports);
		System.out.println("Exit - _toString");
	}
}